package controller

import (
	"fmt"
	"net/http"
	"tiktok2023/model"
	"tiktok2023/service"

	"github.com/gin-gonic/gin"
)

// FavoriteAction no practical effect, just check if token is valid
func FavoriteAction(c *gin.Context) {
	favoriteService := service.FavoriteService{}
	resp, err := favoriteService.HandleFavoriteAction(c)
	if err != nil {
		c.JSON(http.StatusOK, model.Response{StatusCode: 1, StatusMsg: fmt.Sprintf("err:%v", err)})
		return
	}
	c.JSON(http.StatusOK, resp)
}

// FavoriteList all users have same favorite video list
func FavoriteList(c *gin.Context) {
	favoriteService := service.FavoriteService{}
	resp, err := favoriteService.HandleFavoriteList(c)
	if err != nil {
		c.JSON(http.StatusOK, model.Response{StatusCode: 1, StatusMsg: fmt.Sprintf("err:%v", err)})
		return
	}
	c.JSON(http.StatusOK, resp)
}
